package com.amumu.drama.portal.modules.member.service;

import com.amumu.drama.common.modules.invitation.service.InvitationService;
import com.amumu.drama.common.modules.member.service.UmsMemberService;
import com.amumu.drama.model.UmsMember;
import com.amumu.drama.portal.modules.member.dto.resp.MemberInfoResp;
import com.amumu.drama.portal.modules.member.mapper.MemberInfoRespMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author sunzhuang
 * @date 2024/5/24 11:18
 * @slogan 天下风云出我辈, 一入代码岁月催
 * @desc todo
 */

@Service
public class MemberService {

    @Autowired
    private UmsMemberService umsMemberService;

    @Autowired
    private InvitationService invitationService;

    public MemberInfoResp queryMemberInfo(UmsMember member) {
        MemberInfoResp resp = MemberInfoRespMapper.INSTANCE.convertTo(member);
        //查询累计邀请人数
        resp.setInvitationCount(invitationService.countInvitation(member.getId()));
        //查询实名认证状态
        resp.setRealNameStatus(umsMemberService.checkRealName(member));
        return resp;
    }
}
